package com.test.springboot_test.test05_ConfigurationTest;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "myapp.config")
@Data
public class MyAppProperties {

        private String name;
        private String version;
        private Features features;

        public MyAppProperties() {
            this.features = new Features(); // 初始化 features 对象
        }

        // Getter and Setter

        public static class Features {
            private boolean enabled;
            private int retryLimit;

            public boolean isEnabled() {
                return enabled;
            }

            public void setEnabled(boolean enabled) {
                this.enabled = enabled;
            }

            public int getRetryLimit() {
                return retryLimit;
            }

            public void setRetryLimit(int retryLimit) {
                this.retryLimit = retryLimit;
            }
        }
    }